package com.error;

import com.compile;
import com.parser.program;

/**
 * define all the errors
 * @author XiangNi
 * @date 2009-1-29
 */
public class error {
	public static void getError(int no){
		compile.errNo++;
		switch(no){
		case 0:
			System.out.println("No Arguments."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "%s(Line %d Col %d) : Error No.%d ", inputName, thisLineNo, thisColNo, no);
			break;
		case 1:
			System.out.println("The compiler cannot find the input file."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "The compiler cannot find the input file.\n");
			break;
		case 2:
			System.out.println("The output file is not ready yet."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "The output file is not ready yet.\n");
			break;
		case 3:
			System.out.println("Warning:the length of Identifer should be no more than 64"+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "This parameter is illegal.\n");
			break;
		case 4:
			System.out.println("Warning:Numbers cannot begin with 0 except zero itself."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Numbers cannot begin with 0 except zero itself.\n");
			break;
		case 5:
			System.out.println("Warning:Integers should be in a range between -2100000000 and 2100000000."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Integers should be in a range between -2100000000 and 2100000000.\n");
			break;
		case 6:
			System.out.println("Warning Token table is full and identifiers cannot be inserted."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Token table is full and identifiers cannot be inserted.\n");

			break;
		case 7:
			System.out.println("Redefinition of constant."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Redefinition of constant.\n");
			break;
		case 8:
			System.out.println("Redefinition of variable."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Redefinition of variable.\n");
			break;
		case 9:
			System.out.println("Redefinition of function."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Redefinition of function.\n");
			break;
		case 10:
			System.out.println("Sentences should be followed with semicolon(;)."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Sentences should be followed with semicolon(;).\n");
			break;
		case 11:
			System.out.println("After assign symbol should be followed with number."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "After assign symbol should be followed with number.\n");
			break;
		case 12:
			System.out.println("After identifier symbol should be followed with assign symbol."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "After identifier symbol should be followed with assign symbol.\n");
			break;
		case 13:
			System.out.println("After const symbol should be followed with identifier symbol."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "After const symbol should be followed with identifier symbol.\n");
			break;
		case 14:
			System.out.println("Not correct declaration of variable or function."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Not correct declaration of variable or function.\n");
			break;
		case 15:
			System.out.println("Int keyword should be followed with identifiers or function names."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Int keyword should be followed with identifiers or function names.\n");
			break;
		case 16:
			System.out.println("The function should have a return value."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "The function should have a return value.\n");
			break;
		case 17:
			System.out.println("After function's name should be followed with left bracket'('."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "After function's name should be followed with left bracket'('.\n");
			break;
		case 18:
			System.out.println("Main function cannot have parameters."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Main function cannot have parameters.\n");
			break;
		case 19:
			System.out.println("Program cannot have no main function."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Program cannot have no main function.\n");
			break;
		case 20:
			System.out.println("Statement should be ended with semicolon(;)."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Statement should be ended with semicolon(;).\n");
			break;
		case 21:
			System.out.println("Wrong expression in parameter definition."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Wrong expression in parameter definition.\n");
			break;
		case 22:
			System.out.println("Lack of Right Bracket ')'."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Lack of Right Bracket ')'.\n");
			break;
		case 23:
			System.out.println("Lack of INTSYM in parameter definition."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Lack of INTSYM in parameter definition.\n");
			break;
		case 24:
			System.out.println("Compound statement should be started with left brace'{'."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Compound statement should be started with left brace'{'.\n");
			break;
		case 25:
			System.out.println("Compound statement should be ended with right brace'}'."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Compound statement should be ended with right brace'}'.\n");
			break;
		case 26:
			System.out.println("There should be a statement before the semicolon';'."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "There should be a statement before the semicolon';'.\n");
			break;
		case 27:
			System.out.println("if keyword should be followed with left bracket'('."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Lack of right bracket')'.\n");
			break;
		case 28:
			System.out.println("Void function should not have a return value."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Void function should not have a return value.\n");
			break;
		case 29:
			System.out.println("This identifier is illegal."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "This identifier is illegal.\n");
			break;
		case 30:
			System.out.println("Condition should begin with left bracket'('."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Condition should begin with left bracket'('.\n");
			break;
		case 31:
			System.out.println("Function"+compile.tempToken+"is not existed.\n"+"at"+program.tempLineNo+"."+program.tempColNo);
			//fprintf(outputFile, "Function %s is not existed.\n", token);
		case 32:
			System.out.println("Wrong number of parameters."+"at"+program.tempLineNo+"."+program.tempColNo);
			//fprintf(outputFile, "Wrong number of parameters.\n");
			break;
		case 33:
			System.out.println("Variable"+compile.token+"is not existed.\n"+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Variable %s is not existed.\n", token);
			break;
		case 34:
			System.out.println("Identifier"+compile.token+"is not a variable.\n"+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Identifier %s is not a variable.\n", token);
			break;
		case 35:
			System.out.println("Scanf statement should have a parameter of identifier.\n");
			//fprintf(outputFile, "Scanf statement should have a parameter of identifier.\n");
			break;
		case 36:
			System.out.println("It should be followed with identifiers or function names."+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Scanf statement should have a parameter of identifier.\n");
			break;
		case 37:
			System.out.println("Wrong Identifier"+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Scanf statement should have a parameter of identifier.\n");
			break;
		case 38:
			System.out.println("Existing parameter definition"+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Scanf statement should have a parameter of identifier.\n");
			break;
		case 39:
			System.out.println("Identifier"+compile.tempToken+" is not existed"+"at"+compile.LineNo+"."+compile.ColNo);
			//fprintf(outputFile, "Scanf statement should have a parameter of identifier.\n");
			break;
		



		// system errors begins at error No.90
		case 90:
			System.out.println("Memory overflow.\n");
			//fprintf(outputFile, "Memory overflow.\n");
			break;

	    default:;
		}
	}
}
